<?php
namespace App\Admin\Renderable;

use App\Models\User;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
use Dcat\Admin\Models\Administrator;

class UserTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new User(), function (Grid $grid) {
            $grid->model()->where('family_id', $this->payload['id']);
            $grid->column('name', trans('user.fields.name'));
            $grid->column('mobile', trans('user.fields.mobile'));
            $grid->column('gender', trans('user.fields.gender'))->using( config('option.gender'))->label();
            $grid->column('identity_type', trans('user.fields.identity_type'))->using(config('option.identity_type'))->label();
            $grid->column('household', trans('user.fields.household'))->using(config('option.radio_option'))->label(config('option.radio_option_color'));
            $grid->column('is_move_out', trans('user.fields.is_move_out'))->using(config('option.radio_option'))->label(config('option.radio_option_color'));
            $grid->column('is_foreign', trans('user.fields.is_foreign'))->using(config('option.radio_option'))->label(config('option.radio_option_color'));
            $grid->column('is_married', trans('user.fields.is_married'))->using(config('option.married_option'))->label(config('option.radio_option_color'));
            $grid->disableActions();
            $grid->disableRowSelector();
            $grid->disablePagination();
        });
    }
}
